package com.hh.vietnameseproject.ui.login

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Window
import com.google.android.material.tabs.TabLayout
import com.hh.vietnameseproject.R
import com.hh.vietnameseproject.databinding.ActivityLoginBinding

class LoginActivity : AppCompatActivity() {

    lateinit var binding:ActivityLoginBinding

    var al:Float = 0f
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityLoginBinding.inflate(layoutInflater)
        window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS)
        setContentView(binding.root)



        val s = arrayOf("密码登录","验证码登录")

        binding.logintablayout.tabGravity = TabLayout.GRAVITY_FILL

        val adapter = LoginAdapter(supportFragmentManager,this,s.size,s)
        binding.loginviewpager.adapter = adapter
        binding.loginviewpager.addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener(binding.logintablayout))
        binding.logintablayout.setupWithViewPager(binding.loginviewpager)
        binding.logintablayout.translationY = 300f
        binding.loginviewpager.translationY = 300f

        binding.logintablayout.alpha = al
        binding.loginviewpager.alpha = al

        binding.logintablayout.animate().translationY(0f).alpha(1f).setDuration(1000).start()
        binding.loginviewpager.animate().translationY(0f).alpha(1f).setDuration(1000).start()
    }
}